﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Profile;
using System.Web.UI;
using System.Web.UI.WebControls;
using GSSoftSL.Web.Models;
using Newtonsoft.Json;

namespace GSSoftSL.Web
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            DiemSo ds = new DiemSo();
            /*ds.CotDiems = new List<CotDiemInfo>()
                              {
                                  new CotDiemInfo(){ STT = 1, TenCot = "Cột 1"},
                                  new CotDiemInfo(){ STT = 2, TenCot = "Cột 2"}
                              };*/
            List<HocVienDiem> list = new List<HocVienDiem>()
                                         {
                                             new HocVienDiem(){MaHV = "123", HoTen = "Nguyễn Minh Ân", Cot1 = 9, Cot2 = 8},
                                             new HocVienDiem(){MaHV = "456", HoTen = "Nguyễn Tâm Khang", Cot1 = 8.5m, Cot2 = 9.5m}
                                         };
            ds.Diems = list;
            ds.KhoaHocId = Guid.NewGuid();
            DiemSoContractResolver contract = new DiemSoContractResolver(new[] {"MaHV", "HoTen", "Cot1", "Cot2"});
            string str = JsonConvert.SerializeObject(ds, new JsonSerializerSettings()
                                                               {
                                                                   ContractResolver = contract
                                                               });
            Response.Write(str);
        }
    }
}